package com.doit.day05

object _04_scala中的特质 {
  def main(args: Array[String]): Unit = {
    val bird: Bird = new Bird
//    bird.fali()
    //如来佛祖的舅舅
    //特质的动态混入 ==》 针对某一个特殊的对象，赋予特殊的功能
    val bird1: Bird with CanFaLi = new Bird with CanFaLi {
      override def faLi(): Unit = println("我拥有发力")
    }
    bird1.faLi()
  }
}

//单集成  多实现
class Bird extends CanFly with CanStudy {
  override val id: Int = 1

  override def add(a: Int, b: Int): Int = a+b

  override def study(): Unit = println("我会学习")
}
